package com.teamcenter.rac.massupdate.model;

import java.util.ArrayList;
import java.util.Iterator;

import org.eclipse.core.databinding.Binding;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.beans.BeansObservables;
import org.eclipse.core.databinding.observable.list.WritableList;
import org.eclipse.core.databinding.observable.set.WritableSet;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.PropertyDescriptor;

import com.teamcenter.rac.kernel.bom.BOMMarkupHelper;
import com.teamcenter.rac.massupdate.converters.ImageDescriptor2SizedImageConverter;
@SuppressWarnings({"unused","rawtypes","unchecked"})
public class UpdateJobModel extends AbstractObservablePropertySource {
	public static final String LABEL_TEXT_ADD = Messages.UpdateJobModel_LabelText_Add;
	public static final String LABEL_TEXT_ADD_WITH_COLON = Messages.UpdateJobModel_LabelTextWithColon_Add;
	public static final String LABEL_TEXT_REPLACEMENT = Messages.UpdateJobModel_LabelText_Replacement;
	public static final String LABEL_TEXT_REPLACEMENT_WITH_COLON = Messages.UpdateJobModel_LabelTextWithColon_Replacement;
	public static final String PROP_ADD_TO_MARKUP = "addToMarkup";
	public static final String PROP_CHANGE_FIND_TEXT = "changeFindText";
	public static final String PROP_CHANGE_OBJECT = "changeObject";
	public static final String PROP_CHANGE_SUPPORTED = "changeSupported";
	public static final String PROP_IMPACTED_PARTS_UP_TO_DATE = "impactedPartsUpToDate";
	public static final String PROP_INPUT_LABEL_TEXT = "inputLabelText";
	public static final String PROP_INPUT_LABEL_TEXT_WITH_COLON = "inputLabelTextWithColon";
	public static final String PROP_MARKUP_ALLOWED = "markupAllowed";
	public static final String PROP_MARKUP_OBJECT = "markupObject";
	public static final String PROP_OPERATION_TYPE = "operationType";
	public static final String PROP_PROBLEM_FOLDER_ACCESSIBLE = "problemFolderAccessible";
	public static final String PROP_REPLACEMENT_FIND_TEXT = "replacementFindText";
	public static final String PROP_REPLACEMENT_PART = "replacementPart";
	public static final String PROP_REPLACEMENT_PART_IMAGE = "replacementPartImage";
	public static final String PROP_REPLACEMENT_PART_IMAGE_DESCRIPTOR = "replacementPartImageDescriptor";
	public static final String PROP_REPLACEMENT_PART_IMAGE_SIZE = "replacementPartImageSize";
	public static final String PROP_REPLACEMENT_PART_REQUIRED = "replacementPartRequired";
	public static final String PROP_SAVE_REPLACEMENT_PART_IN_FOLDER = "saveReplacementPartInFolder";
	public static final String PROP_SAVE_TARGET_PART_IN_FOLDER = "saveTargetPartInFolder";
	public static final String PROP_SOLUTION_FOLDER_ACCESSIBLE = "solutionFolderAccessible";
	public static final String PROP_SOMETHING_SELECTED = "somethingSelected";
	public static final String PROP_TARGET_FIND_TEXT = "targetFindText";
	public static final String PROP_TARGET_PART = "targetPart";
	public static final String PROP_TARGET_PART_IMAGE = "targetPartImage";
	public static final String PROP_TARGET_PART_IMAGE_DESCRIPTOR = "targetPartImageDescriptor";
	public static final String PROP_TARGET_PART_IMAGE_SIZE = "targetPartImageSize";
	private static final String SECTION_ID_UPDATE_JOB_MODEL = "UpdateJobModel";
	private DataBindingContext m_bindingContext = new DataBindingContext();
	private WritableSet m_checkedRowSetChangeObserver = new IC_CheckedRowSetChangeObserver();
	private WritableList m_impactedParts = new WritableList(new ArrayList(), ImpactedPart.class);
	private IPropertyDescriptor[] m_propertyDescriptors;
	private final String JOB_COMMAND_ID;

	public UpdateJobModel(String paramString) {
		super(23);
		this.JOB_COMMAND_ID = paramString;
		setOperationType(OperationType.REPLACE_PART);
	}

	public void addImpactedPart(ImpactedPart paramImpactedPart) {
		this.m_impactedParts.add(paramImpactedPart);
		IObservableValue localIObservableValue = BeansObservables.observeValue(paramImpactedPart, "selected");
		this.m_bindingContext.bindValue(new IC_SelectedValueChangeObserver(paramImpactedPart), localIObservableValue,
				null, null);
	}

	public void clearAllImpactedParts() {
		this.m_impactedParts.getRealm().exec(new Runnable() {
			public void run() {
				UpdateJobModel.this.m_impactedParts.clear();
				UpdateJobModel.this.m_checkedRowSetChangeObserver.clear();
				ArrayList localArrayList = new ArrayList();
				localArrayList.addAll(UpdateJobModel.this.m_bindingContext.getBindings());
				Iterator localIterator = localArrayList.iterator();
				while (localIterator.hasNext()) {
					Object localObject = localIterator.next();
					UpdateJobModel.this.m_bindingContext.removeBinding((Binding) localObject);
				}
			}
		});
		setSomethingSelected(false);
	}

	public void dispose() {
		if (this.m_bindingContext != null) {
			this.m_bindingContext.dispose();
		}
		Image localImage1 = getTargetPartImage();
		if (localImage1 != null) {
			localImage1.dispose();
		}
		Image localImage2 = getReplacementPartImage();
		if (localImage2 != null) {
			localImage2.dispose();
		}
	}

	public String getChangeFindText() {
		return (String) getPropertyValue("changeFindText");
	}

	public IPropertySource getChangeObject() {
		return (IPropertySource) getPropertyValue("changeObject");
	}

	public WritableSet getCheckedPartSet() {
		return this.m_checkedRowSetChangeObserver;
	}

	public WritableList getImpactedParts() {
		return this.m_impactedParts;
	}

	public String getInputLabelText() {
		return (String) getPropertyValue("inputLabelText");
	}

	public String getInputLabelTextWithColon() {
		return (String) getPropertyValue("inputLabelTextWithColon");
	}

	public IPropertySource getMarkupObject() {
		return (IPropertySource) getPropertyValue("markupObject");
	}

	public OperationType getOperationType() {
		return (OperationType) getPropertyValue("operationType");
	}

	public IPropertyDescriptor[] getPropertyDescriptors() {
		if (this.m_propertyDescriptors == null) {
			ArrayList localArrayList = new ArrayList();
			localArrayList.add(new PropertyDescriptor("changeFindText", Messages.UpdateJobModel_Prop_ChangeFindText));
			localArrayList.add(new PropertyDescriptor("changeObject", Messages.UpdateJobModel_Prop_ChangeObject));
			localArrayList.add(new PropertyDescriptor("impactedPartsUpToDate",
					Messages.UpdateJobModel_Prop_ImpactedPartsUpToDate));
			localArrayList.add(new PropertyDescriptor("markupObject", Messages.UpdateJobModel_Prop_MarkupObject));
			localArrayList.add(new PropertyDescriptor("operationType", Messages.UpdateJobModel_Prop_OperationType));
			localArrayList.add(new PropertyDescriptor("problemFolderAccessible",
					Messages.UpdateJobModel_Prop_ProblemFolderAccessible));
			localArrayList.add(
					new PropertyDescriptor("replacementFindText", Messages.UpdateJobModel_Prop_ReplacementFindText));
			localArrayList.add(new PropertyDescriptor("replacementPart", Messages.UpdateJobModel_Prop_ReplacementPart));
			localArrayList.add(
					new PropertyDescriptor("replacementPartImage", Messages.UpdateJobModel_Prop_ReplacementPartImage));
			localArrayList.add(new PropertyDescriptor("replacementPartImageDescriptor",
					Messages.UpdateJobModel_Prop_ReplacementImageDescriptor));
			localArrayList.add(new PropertyDescriptor("replacementPartImageSize",
					Messages.UpdateJobModel_Prop_ReplacementPartImageSize));
			localArrayList.add(new PropertyDescriptor("replacementPartRequired",
					Messages.UpdateJobModel_Prop_ReplacementPartRequired));
			localArrayList.add(new PropertyDescriptor("saveReplacementPartInFolder",
					Messages.UpdateJobModel_Prop_SaveReplacementPartInFolder));
			localArrayList.add(new PropertyDescriptor("saveTargetPartInFolder",
					Messages.UpdateJobModel_Prop_SaveTargetPartInFolder));
			localArrayList.add(new PropertyDescriptor("solutionFolderAccessible",
					Messages.UpdateJobModel_Prop_SolutionFolderAccessible));
			localArrayList
					.add(new PropertyDescriptor("somethingSelected", Messages.UpdateJobModel_Prop_SomethingSelected));
			localArrayList.add(new PropertyDescriptor("targetFindText", Messages.UpdateJobModel_Prop_TargetFindText));
			localArrayList.add(new PropertyDescriptor("targetPart", Messages.UpdateJobModel_Prop_TargetPart));
			localArrayList.add(new PropertyDescriptor("targetPartImage", Messages.UpdateJobModel_Prop_TargetPartImage));
			localArrayList.add(new PropertyDescriptor("targetPartImageDescriptor",
					Messages.UpdateJobModel_Prop_TargetImageDescriptor));
			localArrayList
					.add(new PropertyDescriptor("targetPartImageSize", Messages.UpdateJobModel_Prop_TargetPartSize));
			this.m_propertyDescriptors = ((IPropertyDescriptor[]) localArrayList
					.toArray(new IPropertyDescriptor[localArrayList.size()]));
		}
		return this.m_propertyDescriptors;
	}

	public String getReplacementFindText() {
		return (String) getPropertyValue("replacementFindText");
	}

	public IPropertySource getReplacementPart() {
		return (IPropertySource) getPropertyValue("replacementPart");
	}

	public Image getReplacementPartImage() {
		return (Image) getPropertyValue("replacementPartImage");
	}

	public ImageDescriptor getReplacementPartImageDescriptor() {
		return (ImageDescriptor) getPropertyValue("replacementPartImageDescriptor");
	}

	public Point getReplacementPartImageSize() {
		return (Point) getPropertyValue("replacementPartImageSize");
	}

	public String getTargetFindText() {
		return (String) getPropertyValue("targetFindText");
	}

	public IPropertySource getTargetPart() {
		return (IPropertySource) getPropertyValue("targetPart");
	}

	public Image getTargetPartImage() {
		return (Image) getPropertyValue("targetPartImage");
	}

	public ImageDescriptor getTargetPartImageDescriptor() {
		return (ImageDescriptor) getPropertyValue("targetPartImageDescriptor");
	}

	public Point getTargetPartImageSize() {
		return (Point) getPropertyValue("targetPartImageSize");
	}

	public boolean isAddToMarkup() {
		return getPropertyValueAsBoolean("addToMarkup");
	}

	public boolean isChangeSupported() {
		return getPropertyValueAsBoolean("changeSupported");
	}

	public boolean isImpactedPartsUpToDate() {
		return getPropertyValueAsBoolean("impactedPartsUpToDate");
	}

	public boolean isMarkupAllowed() {
		return getPropertyValueAsBoolean("markupAllowed");
	}

	public boolean isProblemFolderAccessible() {
		return getPropertyValueAsBoolean("problemFolderAccessible");
	}

	public boolean isReplacementPartRequired() {
		return getPropertyValueAsBoolean("replacementPartRequired");
	}

	public boolean isSaveReplacementPartInFolder() {
		return getPropertyValueAsBoolean("saveReplacementPartInFolder");
	}

	public boolean isSaveTargetPartInFolder() {
		return getPropertyValueAsBoolean("saveTargetPartInFolder");
	}

	public boolean isSolutionFolderAccessible() {
		return getPropertyValueAsBoolean("solutionFolderAccessible");
	}

	public boolean isSomethingSelected() {
		return getPropertyValueAsBoolean("somethingSelected");
	}

	public void restoreModelState(IDialogSettings paramIDialogSettings) {
		IDialogSettings localIDialogSettings = paramIDialogSettings.getSection("UpdateJobModel");
		if (localIDialogSettings != null) {
			String str = localIDialogSettings.get("operationType");
			if (str != null) {
				int i = localIDialogSettings.getInt("operationType");
				setOperationType(OperationType.convertIntToOperationType(i));
			}
		}
	}

	public void saveModelState(IDialogSettings paramIDialogSettings) {
		IDialogSettings localIDialogSettings = paramIDialogSettings.getSection("UpdateJobModel");
		if (localIDialogSettings == null) {
			localIDialogSettings = paramIDialogSettings.addNewSection("UpdateJobModel");
		}
		localIDialogSettings.put("operationType", getOperationType().convertToInt());
	}

	public void setAddToMarkup(boolean paramBoolean) {
		updateAndAnnounceProperty("addToMarkup", Boolean.valueOf(paramBoolean));
	}

	public void setChangeFindText(String paramString) {
		updateAndAnnounceProperty("changeFindText", paramString);
	}

	public void setChangeObject(IPropertySource paramIPropertySource) {
		updateAndAnnounceProperty("changeObject", paramIPropertySource);
	}

	public void setChangeSupported(boolean paramBoolean) {
		updateAndAnnounceProperty("changeSupported", Boolean.valueOf(paramBoolean));
	}

	public void setCheckPartSet(WritableSet paramWritableSet) {
		this.m_checkedRowSetChangeObserver = paramWritableSet;
	}

	public void setImpactedPartsUpToDate(boolean paramBoolean) {
		updateAndAnnounceProperty("impactedPartsUpToDate", Boolean.valueOf(paramBoolean));
	}

	public void setInputLabelText(String paramString) {
		updateAndAnnounceProperty("inputLabelText", paramString);
	}

	public void setInputLabelTextWithColon(String paramString) {
		updateAndAnnounceProperty("inputLabelTextWithColon", paramString);
	}

	public void setMarkupAllowed(boolean paramBoolean) {
		updateAndAnnounceProperty("markupAllowed", Boolean.valueOf(paramBoolean));
	}

	public void setMarkupObject(IPropertySource paramIPropertySource) {
		updateAndAnnounceProperty("markupObject", paramIPropertySource);
	}

	public void setOperationType(OperationType paramOperationType) {
		updateAndAnnounceProperty("operationType", paramOperationType);
	}

	public void setProblemFolderAccessible(boolean paramBoolean) {
		updateAndAnnounceProperty("problemFolderAccessible", Boolean.valueOf(paramBoolean));
	}

	public void setReplacementFindText(String paramString) {
		updateAndAnnounceProperty("replacementFindText", paramString);
	}

	public void setReplacementPart(IPropertySource paramIPropertySource) {
		updateAndAnnounceProperty("replacementPart", paramIPropertySource);
	}

	public void setReplacementPartImage(Image paramImage) {
		updateAndAnnounceImageProperty("replacementPartImage", paramImage);
	}

	public void setReplacementPartImageDescriptor(ImageDescriptor paramImageDescriptor) {
		updateAndAnnounceProperty("replacementPartImageDescriptor", paramImageDescriptor);
		updateImage("replacementPartImageDescriptor", "replacementPartImageSize", "replacementPartImage");
	}

	public void setReplacementPartImageSize(Point paramPoint) {
		updateAndAnnounceProperty("replacementPartImageSize", paramPoint);
		updateImage("replacementPartImageDescriptor", "replacementPartImageSize", "replacementPartImage");
	}

	public void setReplacementPartRequired(boolean paramBoolean) {
		updateAndAnnounceProperty("replacementPartRequired", Boolean.valueOf(paramBoolean));
	}

	public void setSaveReplacementPartInFolder(boolean paramBoolean) {
		updateAndAnnounceProperty("saveReplacementPartInFolder", Boolean.valueOf(paramBoolean));
	}

	public void setSaveTargetPartInFolder(boolean paramBoolean) {
		updateAndAnnounceProperty("saveTargetPartInFolder", Boolean.valueOf(paramBoolean));
	}

	public void setSolutionFolderAccessible(boolean paramBoolean) {
		updateAndAnnounceProperty("solutionFolderAccessible", Boolean.valueOf(paramBoolean));
	}

	public void setSomethingSelected(boolean paramBoolean) {
		updateAndAnnounceProperty("somethingSelected", Boolean.valueOf(paramBoolean));
	}

	public void setTargetFindText(String paramString) {
		updateAndAnnounceProperty("targetFindText", paramString);
	}

	public void setTargetPart(IPropertySource paramIPropertySource) {
		updateAndAnnounceProperty("targetPart", paramIPropertySource);
	}

	public void setTargetPartImage(Image paramImage) {
		updateAndAnnounceImageProperty("targetPartImage", paramImage);
	}

	public void setTargetPartImageDescriptor(ImageDescriptor paramImageDescriptor) {
		updateAndAnnounceProperty("targetPartImageDescriptor", paramImageDescriptor);
		updateImage("targetPartImageDescriptor", "targetPartImageSize", "targetPartImage");
	}

	public void setTargetPartImageSize(Point paramPoint) {
		updateAndAnnounceProperty("targetPartImageSize", paramPoint);
		updateImage("targetPartImageDescriptor", "targetPartImageSize", "targetPartImage");
	}

	private void updateImage(String paramString1, String paramString2, String paramString3) {
		ImageDescriptor localImageDescriptor = (ImageDescriptor) getPropertyValue(paramString1);
		if (localImageDescriptor != null) {
			Point localPoint = (Point) getPropertyValue(paramString2);
			if (localPoint == null) {
				localPoint = new Point(100, 75);
			}
			ImageDescriptor2SizedImageConverter localImageDescriptor2SizedImageConverter = new ImageDescriptor2SizedImageConverter(
					localPoint);
			Image localImage = (Image) localImageDescriptor2SizedImageConverter.convert(localImageDescriptor);
			setPropertyValue(paramString3, localImage);
		} else {
			setPropertyValue(paramString3, null);
		}
	}

	public String getUpdateJobCommandId() {
		return this.JOB_COMMAND_ID;
	}

	private static class IC_CheckedRowSetChangeObserver extends WritableSet {
		public boolean add(Object paramObject) {
			((ImpactedPart) paramObject).setSelected(true);
			return super.add(paramObject);
		}

		public boolean remove(Object paramObject) {
			((ImpactedPart) paramObject).setSelected(false);
			return super.remove(paramObject);
		}
	}

	private class IC_SelectedValueChangeObserver extends WritableValue {
		private ImpactedPart m_impactedPart;

		public IC_SelectedValueChangeObserver(ImpactedPart paramImpactedPart) {
			super(null, Boolean.class);
			this.m_impactedPart = paramImpactedPart;
		}

		public void doSetValue(Object paramObject) {
			if (((Boolean) paramObject).booleanValue()) {
				UpdateJobModel.this.m_checkedRowSetChangeObserver.add(this.m_impactedPart);
			} else {
				UpdateJobModel.this.m_checkedRowSetChangeObserver.remove(this.m_impactedPart);
			}
			UpdateJobModel.this.setSomethingSelected(!UpdateJobModel.this.m_checkedRowSetChangeObserver.isEmpty());
			super.doSetValue(paramObject);
		}
	}

	public static enum OperationType {
		ADD_PART, ADD_PART_AS_SUBSTITUTE, MANUAL_UPDATE, NOT_SET, REMOVE_PART_AND_KEEP_SUBSTITUTE, REMOVE_PART_AND_SUBSTITUTE, REMOVE_SUBSTITUTE, REPLACE_PART, REPLACE_PART_AND_KEEP_AS_SUBSTITUTE, REPLACE_SUBSTITUTE;

		public static final String[] ORDERED_OPTYPE_NAMES = { Messages.OpType_REPLACE_PART,
				Messages.OpType_REPLACE_PART_AND_KEEP_AS_SUBSTITUTE, Messages.OpType_REPLACE_SUBSTITUTE,
				Messages.OpType_ADD_PART, Messages.OpType_ADD_PART_AS_SUBSTITUTE,
				Messages.OpType_REMOVE_PART_AND_SUBSTITUTE, Messages.OpType_REMOVE_PART_AND_KEEP_SUBSTITUTE,
				Messages.OpType_REMOVE_SUBSTITUTE, Messages.OpType_MANUAL_UPDATE };
		public static final OperationType[] ORDERRED_OP_TYPES = { REPLACE_PART, REPLACE_PART_AND_KEEP_AS_SUBSTITUTE,
				REPLACE_SUBSTITUTE, ADD_PART, ADD_PART_AS_SUBSTITUTE, REMOVE_PART_AND_SUBSTITUTE,
				REMOVE_PART_AND_KEEP_SUBSTITUTE, REMOVE_SUBSTITUTE, MANUAL_UPDATE };
		private static final int ADD_PART_AS_SUBSTITUTE_TYPE = BOMMarkupHelper.MarkupType.PS_MARKUP_ADD.toInt()
				| BOMMarkupHelper.MarkupType.PS_MARKUP_SUBSTITUTE.toInt();
		private static final int ADD_PART_TYPE = BOMMarkupHelper.MarkupType.PS_MARKUP_ADD.toInt();
		private static final int MANUAL_UPDATE_TYPE = BOMMarkupHelper.MarkupType.PS_MARKUP_REVISE.toInt();
		private static final int NOT_SET_TYPE = BOMMarkupHelper.MarkupType.PS_MARKUP_NONE.toInt();
		private static final int REMOVE_PART_AND_KEEP_SUBSTITUTE_TYPE = BOMMarkupHelper.MarkupType.PS_MARKUP_REMOVE
				.toInt() | BOMMarkupHelper.MarkupType.PS_MARKUP_ADD.toInt()
				| BOMMarkupHelper.MarkupType.PS_MARKUP_SUBSTITUTE.toInt();
		private static final int REMOVE_PART_AND_SUBSTITUTE_TYPE = BOMMarkupHelper.MarkupType.PS_MARKUP_REMOVE.toInt();
		private static final int REMOVE_SUBSTITUTE_TYPE = BOMMarkupHelper.MarkupType.PS_MARKUP_REMOVE.toInt()
				| BOMMarkupHelper.MarkupType.PS_MARKUP_SUBSTITUTE.toInt();
		private static final int REPLACE_PART_AND_KEEP_AS_SUBSTITUTE_TYPE = BOMMarkupHelper.MarkupType.PS_MARKUP_REPLACE
				.toInt() | BOMMarkupHelper.MarkupType.PS_MARKUP_ADD.toInt()
				| BOMMarkupHelper.MarkupType.PS_MARKUP_SUBSTITUTE.toInt();
		private static final int REPLACE_PART_TYPE = BOMMarkupHelper.MarkupType.PS_MARKUP_REPLACE.toInt();
		private static final int REPLACE_SUBSTITUTE_TYPE = BOMMarkupHelper.MarkupType.PS_MARKUP_REPLACE.toInt()
				| BOMMarkupHelper.MarkupType.PS_MARKUP_SUBSTITUTE.toInt();

		public static String convertIntToDisplayString(int paramInt) {
			if (paramInt == REPLACE_PART_TYPE) {
				return ORDERED_OPTYPE_NAMES[0];
			}
			if (paramInt == REPLACE_PART_AND_KEEP_AS_SUBSTITUTE_TYPE) {
				return ORDERED_OPTYPE_NAMES[1];
			}
			if (paramInt == REPLACE_SUBSTITUTE_TYPE) {
				return ORDERED_OPTYPE_NAMES[2];
			}
			if (paramInt == ADD_PART_TYPE) {
				return ORDERED_OPTYPE_NAMES[3];
			}
			if (paramInt == ADD_PART_AS_SUBSTITUTE_TYPE) {
				return ORDERED_OPTYPE_NAMES[4];
			}
			if (paramInt == REMOVE_PART_AND_SUBSTITUTE_TYPE) {
				return ORDERED_OPTYPE_NAMES[5];
			}
			if (paramInt == REMOVE_PART_AND_KEEP_SUBSTITUTE_TYPE) {
				return ORDERED_OPTYPE_NAMES[6];
			}
			if (paramInt == REMOVE_SUBSTITUTE_TYPE) {
				return ORDERED_OPTYPE_NAMES[7];
			}
			if (paramInt == MANUAL_UPDATE_TYPE) {
				return ORDERED_OPTYPE_NAMES[8];
			}
			return String.valueOf(paramInt);
		}

		public static OperationType convertIntToOperationType(int paramInt) {
			if (paramInt == REPLACE_PART_TYPE) {
				return REPLACE_PART;
			}
			if (paramInt == REPLACE_PART_AND_KEEP_AS_SUBSTITUTE_TYPE) {
				return REPLACE_PART_AND_KEEP_AS_SUBSTITUTE;
			}
			if (paramInt == REPLACE_SUBSTITUTE_TYPE) {
				return REPLACE_SUBSTITUTE;
			}
			if (paramInt == ADD_PART_TYPE) {
				return ADD_PART;
			}
			if (paramInt == ADD_PART_AS_SUBSTITUTE_TYPE) {
				return ADD_PART_AS_SUBSTITUTE;
			}
			if (paramInt == REMOVE_PART_AND_SUBSTITUTE_TYPE) {
				return REMOVE_PART_AND_SUBSTITUTE;
			}
			if (paramInt == REMOVE_PART_AND_KEEP_SUBSTITUTE_TYPE) {
				return REMOVE_PART_AND_KEEP_SUBSTITUTE;
			}
			if (paramInt == REMOVE_SUBSTITUTE_TYPE) {
				return REMOVE_SUBSTITUTE;
			}
			if (paramInt == MANUAL_UPDATE_TYPE) {
				return MANUAL_UPDATE;
			}
			return NOT_SET;
		}

		public static String convertOperation2Description(OperationType paramOperationType) {
			switch (paramOperationType) {
			case ADD_PART:
				return Messages.OpType_ADD_PART_TIP;
			case ADD_PART_AS_SUBSTITUTE:
				return Messages.OpType_ADD_PART_AS_SUBSTITUTE_TIP;
			case MANUAL_UPDATE:
				return Messages.OpType_MANUAL_UPDATE_TIP;
			case NOT_SET:
				return "";
			case REMOVE_PART_AND_KEEP_SUBSTITUTE:
				return Messages.OpType_REMOVE_PART_AND_KEEP_SUBSTITUTE_TIP;
			case REMOVE_PART_AND_SUBSTITUTE:
				return Messages.OpType_REMOVE_PART_AND_SUBSTITUTE_TIP;
			case REMOVE_SUBSTITUTE:
				return Messages.OpType_REMOVE_SUBSTITUTE_TIP;
			case REPLACE_PART:
				return Messages.OpType_REPLACE_PART_TIP;
			case REPLACE_PART_AND_KEEP_AS_SUBSTITUTE:
				return Messages.OpType_REPLACE_PART_AND_KEEP_AS_SUBSTITUTE_TIP;
			case REPLACE_SUBSTITUTE:
				return Messages.OpType_REPLACE_SUBSTITUTE_TIP;
			}
			return null;
		}

		@SuppressWarnings("incomplete-switch")
		public int convertToInt() {
			switch (this) {
			case REPLACE_PART:
				return REPLACE_PART_TYPE;
			case REPLACE_PART_AND_KEEP_AS_SUBSTITUTE:
				return REPLACE_PART_AND_KEEP_AS_SUBSTITUTE_TYPE;
			case REPLACE_SUBSTITUTE:
				return REPLACE_SUBSTITUTE_TYPE;
			case ADD_PART:
				return ADD_PART_TYPE;
			case ADD_PART_AS_SUBSTITUTE:
				return ADD_PART_AS_SUBSTITUTE_TYPE;
			case REMOVE_PART_AND_SUBSTITUTE:
				return REMOVE_PART_AND_SUBSTITUTE_TYPE;
			case REMOVE_PART_AND_KEEP_SUBSTITUTE:
				return REMOVE_PART_AND_KEEP_SUBSTITUTE_TYPE;
			case REMOVE_SUBSTITUTE:
				return REMOVE_SUBSTITUTE_TYPE;
			case MANUAL_UPDATE:
				return MANUAL_UPDATE_TYPE;
			}
			return NOT_SET_TYPE;
		}
	}
}